package cn.wolfcode.ssm.domain;

import cn.wolfcode.ssm.enums.NoticeStatusEnum;
import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

@Getter
@Setter
public class Notice {
    /** */
    private Long id;

    /** */
    private String title;

    /** */
    private String context;


    /** */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createDate;

    /** */
    private Integer level;

    /** */
    private Boolean readStatus;

    /** */
    private Boolean releaseStatus;

    private Employee creator;

    private ReadStatus readCount;

    public String getLevelName(){
        return NoticeStatusEnum.findEnumNameByValue(this.level);
    }

    public String toJson(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("title",title);
        map.put("context",context);
        map.put("level",level);
        return JSON.toJSONString(map);
    }


}